[
    {
        "id": "0364d0b105293afc",
        "type": "comment",
        "z": "2cdc739225d6a4e8",
        "name": "Example: Link Call",
        "info": "### Link call node\nThe `link call` node can call a `link in` node then get result from `link out` node.\nIt can be set to a fixed target or passed a `target` in the `msg` for dynamic calling.\n\n### Function link call\nA `link in` node can be called from a function using `node.linkcall`\n",
        "x": 170,
        "y": 60,
        "wires": []
    },
    {
        "id": "f0e17fb6266e3e46",
        "type": "comment",
        "z": "2cdc739225d6a4e8",
        "name": "↓ call link (fixed target)",
        "info": "",
        "x": 420,
        "y": 120,
        "wires": []
    },
    {
        "id": "2869c5a483bad49f",
        "type": "inject",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 200,
        "y": 160,
        "wires": [
            [
                "06a8cdd201630b4c"
            ]
        ]
    },
    {
        "id": "943afa6102c26e24",
        "type": "debug",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 160,
        "wires": []
    },
    {
        "id": "06a8cdd201630b4c",
        "type": "link call",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "links": [
            "e1b6b1fbd9b33c6d"
        ],
        "timeout": "30",
        "x": 390,
        "y": 160,
        "wires": [
            [
                "943afa6102c26e24"
            ]
        ]
    },
    {
        "id": "b23d2de4047ac09b",
        "type": "link call",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "links": [
            "e1b6b1fbd9b33c6d"
        ],
        "linkType": "dynamic",
        "timeout": "30",
        "x": 380,
        "y": 280,
        "wires": [
            [
                "94c83d101ad168b0"
            ]
        ]
    },
    {
        "id": "2706a2894820982a",
        "type": "inject",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "target",
                "v": "subroutine-1",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 200,
        "y": 280,
        "wires": [
            [
                "b23d2de4047ac09b"
            ]
        ]
    },
    {
        "id": "94c83d101ad168b0",
        "type": "debug",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 280,
        "wires": []
    },
    {
        "id": "57355f9fbe74f23c",
        "type": "comment",
        "z": "2cdc739225d6a4e8",
        "name": "↓ set msg.target",
        "info": "",
        "x": 200,
        "y": 240,
        "wires": []
    },
    {
        "id": "558bf6ebcececd37",
        "type": "inject",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "target",
                "v": "subroutine-1",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 200,
        "y": 400,
        "wires": [
            [
                "9095bcd27e7c3bd7"
            ]
        ]
    },
    {
        "id": "4dbf26da9c203018",
        "type": "debug",
        "z": "2cdc739225d6a4e8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 400,
        "wires": []
    },
    {
        "id": "2b032ec174258528",
        "type": "comment",
        "z": "2cdc739225d6a4e8",
        "name": "↓ call subroutine-1 from a function",
        "info": "",
        "x": 450,
        "y": 360,
        "wires": []
    },
    {
        "id": "9095bcd27e7c3bd7",
        "type": "function",
        "z": "2cdc739225d6a4e8",
        "name": "call subroutine-1",
        "func": "\nconst m = await node.linkcall('subroutine-1', msg, { timeout: 1000 })\n\nreturn m;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 400,
        "y": 400,
        "wires": [
            [
                "4dbf26da9c203018"
            ]
        ]
    },
    {
        "id": "4237c6c2ee2e5c03",
        "type": "comment",
        "z": "2cdc739225d6a4e8",
        "name": "↓ call link in (target set by msg.target)",
        "info": "",
        "x": 470,
        "y": 240,
        "wires": []
    },
    {
        "id": "502424230fe03b8e",
        "type": "group",
        "z": "2cdc739225d6a4e8",
        "name": "subroutine-1",
        "style": {
            "label": true
        },
        "nodes": [
            "e1b6b1fbd9b33c6d",
            "547ff90d37be5bfa",
            "5dc4c8eee329ed86",
            "37c42be69a257586",
            "f2a44468d6af6018"
        ],
        "x": 134,
        "y": 499,
        "w": 532,
        "h": 122
    },
    {
        "id": "e1b6b1fbd9b33c6d",
        "type": "link in",
        "z": "2cdc739225d6a4e8",
        "g": "502424230fe03b8e",
        "name": "subroutine-1",
        "links": [],
        "x": 175,
        "y": 540,
        "wires": [
            [
                "547ff90d37be5bfa"
            ]
        ]
    },
    {
        "id": "547ff90d37be5bfa",
        "type": "change",
        "z": "2cdc739225d6a4e8",
        "g": "502424230fe03b8e",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Hello, from subroutine-1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 400,
        "y": 540,
        "wires": [
            [
                "5dc4c8eee329ed86"
            ]
        ]
    },
    {
        "id": "5dc4c8eee329ed86",
        "type": "link out",
        "z": "2cdc739225d6a4e8",
        "g": "502424230fe03b8e",
        "name": "",
        "mode": "return",
        "links": [],
        "x": 625,
        "y": 540,
        "wires": []
    },
    {
        "id": "37c42be69a257586",
        "type": "comment",
        "z": "2cdc739225d6a4e8",
        "g": "502424230fe03b8e",
        "name": "↑ link node \"sunbroutine-1\"",
        "info": "",
        "x": 270,
        "y": 580,
        "wires": []
    },
    {
        "id": "f2a44468d6af6018",
        "type": "comment",
        "z": "2cdc739225d6a4e8",
        "g": "502424230fe03b8e",
        "name": "return to caller ↑ ",
        "info": "",
        "x": 560,
        "y": 580,
        "wires": []
    }
]